#pragma once


class CPgQueryRes
{
public:
	CPgQueryRes()
		: m_row(0)
		, m_col(0)
	{}
	virtual ~CPgQueryRes(){}
public:
	bool empty()
	{
		return m_vecValues.empty();
	}
	string getValue(const string& strKey, int nIndex = 0, const string& strDefault="")
	{
		if(nIndex >= m_row)
		{
			//RT_ASSERTE(0);
			return strDefault;
		}

		string strValue;
		int nCol = 0;
		for(nCol=0; nCol != (int)m_vecNames.size(); nCol++)
		{
			if(m_vecNames[nCol] == strKey)
			{
				strValue = m_vecValues[nCol+ m_col*nIndex];
				break;
			}
		}
		if(strValue.empty())
			strValue = strDefault;
		return strValue;
	}
	int size()
	{
		return m_row;
	}
	void clear()
	{
		m_vecNames.clear();
		m_vecValues.clear();
		m_row = 0;
		m_col = 0;
	}
public:
	vector<string>	m_vecNames;
	vector<string>	m_vecValues;
	int m_row;
	int m_col;
};











